﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GoodsInvoicing.BLL.Service;
using GoodsInvoicing.DAL.DAO;

namespace GoodsInvoicing.BLL.ServiceImpl
{
    public class BaseService<TEntity, TId> : IService<TEntity, TId>
    {
        protected IDAO<TEntity, TId> dao = null;
        public IDAO<TEntity, TId> DAO 
        {
            set { this.DAO = value; } 
        }
        
        public TEntity Get(TId id)
        {
            return dao.Get(id);
        }

        public IList<TEntity> GetAll()
        {
            return dao.GetAll();
        }

        public TId Save(TEntity entity)
        {
            return dao.Save(entity);
        }

        public void Update(TEntity entity)
        {
            dao.Update(entity);
        }

        public void Delete(TEntity entity)
        {
            dao.Delete(entity);
        }
    }
}
